<!DOCTYPE html>
<html lang="en">
	<head>

		<meta charset="UTF-8">
		<meta name="viewport"
			content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<meta name="referrer" content="never">


		<title>{if condition="$userInfo"} {$article['title']} {else /} 没有找到该文章信息 {/if} </title>


		<div id='wx_pic' style='margin:0 auto;display:none;'>
			<img width="0" height="0" src="{$article['cover']}" />
		</div>

	</head>

	<script src="//res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>

	<script>
		var gzh_appid = "{$config['gzh_appid']}";
		var signature = "{$signature}";
		var nonceStr = "{$nonceStr}";
		var timestamp = "{$timestamp}";
		var article_url = "{$article_url|raw}";
		console.log('article_url', article_url);
		console.log('str', "{$str|raw}");
		wx.config({
			debug: false,
			appId: gzh_appid,
			timestamp: timestamp,
			nonceStr: nonceStr,
			signature: signature,
			jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData',

				'onMenuShareAppMessage', //旧的接口，即将废弃

				'onMenuShareTimeline', //旧的接口，即将废弃
			]
		});


		wx.ready(function() {
			var article_title = "{$article['title']}";
			var url_now = "{$url_now|raw}";
			var article_cover = "{$article['cover']}";

			wx.updateAppMessageShareData({
				title: article_title,
				desc: article_title,
				link: url_now,
				imgUrl: article_cover,
				success: function(event) {
					// shareRecord('updateAppMessageShareData');
				},
				fail: function(res) {
					console.log('updateAppMessageShareData_fail', res);
				},

			});

			wx.updateTimelineShareData({
				title: article_title,
				link: url_now,
				imgUrl: article_cover,
				success: function() {
					// 设置成功
					// 设置成功
					// shareRecord('updateTimelineShareData');
				},
			});


			wx.onMenuShareTimeline({
				title: article_title, // 分享标题
				link: url_now, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				imgUrl: article_cover, // 分享图标
				success: function() {
					// 用户点击了分享后执行的回调函数
					console.log('onMenuShareTimeline')
					// shareRecord('updateAppMessageShareData');

				}
			});


			wx.onMenuShareAppMessage({
				title: article_title, // 分享标题
				desc: article_title, // 分享描述
				link: url_now, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				imgUrl: article_cover, // 分享图标
				type: 'link', // 分享类型,music、video或link，不填默认为link
				dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
				success: function() {
					// 用户点击了分享后执行的回调函数
					console.log('onMenuShareAppMessage')
					// shareRecord('updateAppMessageShareData');

				}
			});
		});

		function shareRecord(test) {
			var record_url = '{$share_record_url|raw}';
			var id = "{$article['id']}";
			if (id > 0) {
				$.ajax({
					type: 'post',
					url: record_url,
					dataType: 'json',
					data: {
						'id': id,
						'to_uid': '{$to_uid}',
						'type': 1,
						'test': test
					},
					success: function(data) {
						console.log("updateAppMessageShareData 成功")
					}
				})
			}
		}
	</script>

	<!--<script type="text/javascript" src="/addons/longbing_card/core/public/js/jquery.min.js"></script>-->


	<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>

	<script>
		$(function() {
			// 上报浏览时间
			setInterval(() => {
				onbeforeunload();
			}, 3000);

			var navH = $("#card-mini").offset().top;
			$(window).scroll(function() {
				var scroH = $(this).scrollTop();
				if (scroH >= navH) {
					$("#card-mini").addClass("fixed-top");
					$(".card-mini-1").addClass("hide");
					$(".card-mini-2").removeClass("hide").addClass("show");
				} else if (scroH < navH) {
					$("#card-mini").removeClass("fixed-top");
					$(".card-mini-1").removeClass("hide");
					$(".card-mini-2").removeClass("show").addClass("hide");
				}
			})
		})

		function navigateTo(obj) {
			let id = $(obj).attr("data-id");
			let tmp_result = '{$article_url|raw}';
			tmp_result = id ? tmp_result + `&id=` + id : '{$list_url|raw}';
			console.log(tmp_result, "navigateTo")
			window.open(tmp_result, "_top");
		}

		function toSee(obj) {
			$(".bg_opacity_sec").removeClass("hide");
			$(".card-mini-show-qr").removeClass("hide");
		}

		function toClose(obj) {
			$(".bg_opacity_sec").addClass("hide");
			$(".card-mini-show-qr").addClass("hide");
		}

		function onbeforeunload() {
			let ajax_url = '{$record_url|raw}';
			let ajax_record_id = '{$record_id}';
			if (ajax_record_id > 0) {
				console.log('上报')
				$.ajax({
					type: 'post',
					url: ajax_url,
					dataType: 'json',
					data: {
						'record_id': ajax_record_id,
					},
					success: function(data) {
						console.log("onbeforeunload 上报成功")
					}
				})
			}

			let count_id = '{$count_id}';
			let count_url = '{$count_url|raw}';

			if (count_id > 0) {
				console.log('上报雷达')
				$.ajax({
					type: 'post',
					url: count_url,
					dataType: 'json',
					data: {
						'id': count_id,
					},
					success: function(data) {
						console.log("雷达上报成功")
					}
				})
			}
		}
	</script>



	<style>
		* {
			padding: 0px;
			margin: 0px;
			text-decoration: none;
			font-style: normal;
			max-width: 100%;
			/*overflow-x: hidden;*/
		}

		body {
			background: #f6f5fa;
		}

		.wxw-img {
			vertical-align: bottom;
		}


		.max-225 {
			max-width: 225px;
		}

		.max-100 {
			max-width: 100%;
		}

		.no-data i {
			font-size: 100px;
			color: #ee234e;
		}

		.detail-auth-time {
			width: 100%;
			height: 20px;
			line-height: 20px;
			display: block;
		}

		.detail-auth-time em {
			max-width: 50%;
		}

		.card-mini {
			width: 84%;
			height: auto;
			margin: 0px auto;
			padding: 10px 4%;
		}

		.card-mini-user-img {
			width: 50px;
			height: 50px;
		}

		.card-mini-qr {
			width: 80px;
			height: 80px;
		}

		.card-mini-btn {
			width: 65px;
			height: 32px;
			line-height: 32px;
			display: block;
			color: white;
			background: #ee234e;
		}

		.card-mini-qr {
			width: 85px;
			height: 85px;
			top: 20px;
			right: 20px;
		}

		.bg_opacity_sec {
			background: #000;
			background: rgba(0, 0, 0, 0.5);
			filter: Alpha(opacity=50);
			color: white;
			width: 100%;
			height: 100%;
			display: inline-block;
			top: 0px;
			left: 0px;
			right: 0px;
			bottom: 0px;
			z-index: 91;
		}

		.card-mini-show-qr {
			width: 80%;
			height: auto;
			display: inline-block;
			top: 50%;
			right: 10%;
			-webkit-transform: translate(0, -50%);
			transform: translate(0, -50%);
			z-index: 92;
		}

		.show-qr-img {
			width: 80%;
			height: 80%;
			margin: 0px auto;
		}

		.article-child {
			padding: 15px 4%;
		}

		.article-img {
			width: 65px;
			height: 65px;
			display: block;
		}

		.article-title {
			line-height: 20px;
			height: 40px;
			font-size: 16px;
		}

		.article-text,
		.article-text i {
			color: #c8c8c8;
		}

		.detail-share {
			width: 100%;
			height: auto;
			bottom: 0px;
			display: block;
			padding-top: 15px;
			background: #f0f0f0;
			z-index: 91;
		}

		.detail-share button {
			width: 25%;
			height: auto;
			display: inline-block;
			/* float: left; */
			background: none;
			border-radius: 0px;
		}

		.detail-share button.w-33 {
			width: 33.3%;
		}

		.box-shadow {
			box-shadow: 0 3px 30px rgba(21, 13, 13, 0.05);
		}

		.fill-base {
			background: white;
		}

		.f-icontext {
			font-size: 12px;
		}

		.f-caption {
			font-size: 14px;
		}

		.f-paragraph {
			font-size: 15px;
		}

		.f-title {
			font-size: 17px;
		}

		.c-black {
			color: black;
		}

		.c-title {
			color: #333;
		}

		.c-caption {
			color: #888888;
		}

		.c-paragraph {
			color: #646464;
		}

		.mt-sm {
			margin-top: 2px;
		}

		.ml-md {
			margin-left: 6px;
		}

		.ml-lg {
			margin-left: 8px;
		}

		.space-md {
			height: 10px;
		}

		.space-xl {
			height: 30px;
		}

		.fl {
			float: left;
		}

		.fr {
			float: right;
		}

		.ellipsis {
			display: block;
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
		}

		.clamp2,
		.clamp3,
		.clamp4 {
			display: -webkit-box;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 2;
			overflow: hidden;
		}

		.clamp2 {
			-webkit-line-clamp: 2;
		}

		.clamp3 {
			-webkit-line-clamp: 3;
		}

		.clamp4 {
			-webkit-line-clamp: 4;
		}

		.br-5 {
			-webkit-border-radius: 3px;
			-moz-border-radius: 3px;
			border-radius: 3px;
		}

		.br-10 {
			-webkit-border-radius: 5px;
			-moz-border-radius: 5px;
			border-radius: 5px;
		}

		.br-15 {
			-webkit-border-radius: 10px;
			-moz-border-radius: 10px;
			border-radius: 10px;
		}

		/* 箭头 */
		.right-arrow {
			display: inline-block;
			position: relative;
			width: 16px;
			height: 16px;
		}

		.right-arrow::after {
			display: inline-block;
			content: " ";
			height: 6px;
			width: 6px;
			border-width: 2px;
			border-color: #bbbbbb;
			border-left-color: transparent;
			border-bottom-color: transparent;
			border-style: solid;
			transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
			position: absolute;
			top: 6px;
			right: 4px;
		}

		.show {
			display: block !important;
		}

		.hide {
			display: none !important;
		}

		.bg-f4f6f8 {
			background: #f4f6f8;
		}

		.rel {
			position: relative;
		}

		.abs {
			position: absolute;
		}

		.fix {
			position: fixed;
		}

		.flex {
			display: flex;
		}

		.flex-1 {
			flex: 1
		}

		.flex-center {
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.tc {
			text-align: center
		}

		.tr {
			text-align: right
		}

		.b-1px-t,
		.b-1px-b {
			position: relative;
		}

		.b-1px-t:before {
			content: " ";
			position: absolute;
			left: 0;
			top: 0;
			right: 0;
			height: 1px;
			border-top: 1px solid rgba(216, 216, 216, 1);
			color: rgba(216, 216, 216, 1);
			transform-origin: 0 0;
			transform: scaley(0.5);
			box-sizing: border-box
		}

		.b-1px-b::after {
			content: " ";
			position: absolute;
			left: 0;
			bottom: 0;
			right: 0;
			height: 1px;
			border-bottom: 1px solid rgba(216, 216, 216, 1);
			color: rgba(216, 216, 216, 1);
			transform-origin: 0 100%;
			transform: scaley(0.5);
			box-sizing: border-box
		}

		.fixed-top {
			position: fixed;
			top: 0px;
			width: 100%;
			z-index: 9
		}


		.detail-content {
			overflow: hidden;
			color: #333;
			font-size: 16px;
			word-wrap: break-word;
			-webkit-hyphens: auto;
			-ms-hyphens: auto;
			hyphens: auto;
			text-align: justify;
			position: relative;
			z-index: 0
		}

		.detail-content * {
			max-width: 100% !important;
			box-sizing: border-box !important;
			-webkit-box-sizing: border-box !important;
			word-wrap: break-word !important
		}

		.detail-content p {
			clear: both;
			min-height: 1em
		}

		.detail-content em {
			font-style: italic
		}

		.detail-content fieldset {
			min-width: 0
		}

		.detail-content .list-paddingleft-1,
		.detail-content .list-paddingleft-2,
		.detail-content .list-paddingleft-3 {
			padding-left: 2.2em
		}

		.detail-content .list-paddingleft-1 .list-paddingleft-2,
		.detail-content .list-paddingleft-2 .list-paddingleft-2,
		.detail-content .list-paddingleft-3 .list-paddingleft-2 {
			padding-left: 30px
		}

		.detail-content .list-paddingleft-1 {
			padding-left: 1.2em
		}

		.detail-content .list-paddingleft-3 {
			padding-left: 3.2em
		}

		.detail-content .code-snippet,
		.detail-content .code-snippet__fix {
			max-width: 1000% !important
		}

		.detail-content .code-snippet *,
		.detail-content .code-snippet__fix * {
			max-width: 1000% !important
		}

		.detail-content img {
			height: auto !important;
		}

		.no-data-img {
			width: 50px;
			height: 50px;
		}

		.loading {
			padding: 15px 0px;
		}

		.loading_more {
			display: block;
			height: 1.5em;
			width: 100%;
		}

		.loading_more:before {
			display: inline-block;
			vertical-align: text-bottom;
			content: ' ';
			height: 16px;
			width: 16px;
			margin-right: 6px;
			background: url(/addons/longbing_card/core/public/static/resource/loading_more.gif) no-repeat center;
			-webkit-background-size: contain;
			background-size: contain;
		}

		.loading_more:after {
			content: '加载更多...';
		}
	</style>

	<body>
		{if condition="$userInfo"}

		<!-- 如果有文章内容  START -->
		<div class="fill-base" style="padding:0px 4%;">
			<div class="f-title c-black" style="padding-top:20px;">{$article['title']}</div>
			<div class="detail-auth-time mt-sm"><em class="f-paragraph ellipsis fl"
					style="color:#536596;">{$userInfo['name']}</em><em class="ml-md f-icontext c-paragraph fl ellipsis"
					style="max-width:45%;">{$article['create_time2']}</em></div>
			<div class="space-md"></div>
		</div>

		<!-- 页面滑动置顶效果 -->
		<div id="card-mini">
			<div class="fill-base card-mini-1" style="padding:10px 0px;">
				<div class="card-mini flex-center fill-base box-shadow br-15">
					<img class="bg-f4f6f8 card-mini-user-img br-10" src="{$userInfo['avatar']}" />
					<div class="flex-1" style="max-width:330px;margin-left:10px;">
						<div class="f-title c-title ellipsis">{$userInfo['name']}</div>
						<div class="f-caption c-caption ellipsis">{$job['name']}</div>
					</div>
					<div onclick="toSee(this)" class="flex-1 tr">
						<div class="f-icontext tc fr c-base br-10 card-mini-btn">查看名片</div>
					</div>
				</div>
			</div>
			<div class="fill-base b-1px-b card-mini-2 hide">
				<div class="card-mini flex-center fill-base b-1px-b" style="width:92%;padding:10px 4%;">
					<img class="bg-f4f6f8 card-mini-user-img br-10" src="{$userInfo['avatar']}" />
					<div class="flex-1" style="max-width:230px;margin-left:20px;">
						<div class="f-title c-title ellipsis">{$userInfo['name']}</div>
					</div>
					<div onclick="toSee(this)" class="flex-1 tr">
						<div class="f-icontext tc fr c-base br-10 card-mini-btn">查看名片</div>
					</div>
				</div>
			</div>
		</div>

		<!-- 点击【查看名片】显示名片小程序码 -->
		<div onclick="toClose(this)" class="bg_opacity_sec fix hide"></div>
		<div class="card-mini-show-qr fill-base tc br-15 fix hide">
			<div class="space-xl"></div>
			<img class="show-qr-img" src="{$qr_path}" />
			<div class="space-md"></div>
			<div class="f-paragraph c-caption tc">长按识别小程序码</div>
			<div class="space-xl"></div>
		</div>

		<!-- 文章详情 -->
		<div id="fill-content" class="fill-base detail-content" style="padding:10px 4%;overflow: hidden;">{$content|raw}
		</div>

		<!-- 底部名片 -->
		<div class="space-md"></div>
		<div class="card-mini fill-base box-shadow br-15 rel" style="padding:15px 4%;">
			<div>
				<div class="c-title ellipsis max-225" style="font-size:20px;">{$userInfo['name']}</div>
				<div class="f-caption c-caption mt-sm ellipsis  max-225">{$job['name']}</div>
				<div class="space-xl"></div>
				<div class="space-md"></div>
				<div class="f-caption c-title ellipsis max-100">{$company['name']}</div>
				<div class="f-caption ellipsis max-100" style="color:#ee234e;margin-top:3px;">{$userInfo['phone']}</div>
			</div>
			<img class="card-mini-qr abs" src="{$qr_path}" />
			<div class="f-icontext c-caption abs tr" style="bottom: 20px;right: 20px;">长按识别小程序码</div>
		</div>
		<div class="space-md"></div>

		<!-- TA的热门文章 -->
		{if condition="$articles"}
		<div onclick="navigateTo(this)" data-url="{$list_url}" data-uid="{$to_uid}"
			class="flex-center b-1px-b fill-base" style="padding:0px 4%;height:50px;">
			<div class="f-title c-black">TA的热门文章</div>
			<div class="flex-1 f-caption c-caption tr">更多<i class="right-arrow f-caption"></i></div>
		</div>
		<!-- TA的热门文章列表 -->
		<div class="article-list fill-base">
			{volist name="articles" id="data"}
			<div onclick="navigateTo(this)" data-id="{$data['id']}" class="article-child flex-center b-1px-b">
				<img class="article-img bg-f4f6f8 br-5" src="{$data.cover}" mode="aspectFill" />
				<div class="flex-1 ml-lg">
					<div class="c-title clamp2 article-title">{$data['title']}</div>
					<div class="flex mt-sm" style="max-width:520px;">
						<div class="f-caption c-caption ellipsis">{$data['create_time2']}</div>
					</div>
				</div>
			</div>
			{/volist}
		</div>
		{/if}

		<!-- 如果有文章内容  END -->

		{else /}

		<!-- 如果没有文章内容 -->
		<div class="no-data tc">
			<div class="space-xl"></div>
			<div class="space-xl"></div>
			<img class="no-data-img" src="/addons/longbing_card/core/public/static/resource/err.png" />
			<div class="f-caption c-caption">没有找到该文章信息</div>
			<div class="space-xl"></div>
		</div>
		{/if}

	</body>
</html>
